import constant from '../constant'


import storage from '../utils/storage'


export default {
    // 获取时间戳
    getTimeStamp(){
        return storage.getItem(constant.TIME_STAMP)
    },
    // 设置时间戳
    setTimeStamp(){
        storage.setItem(constant.TIME_STAMP, Date.now())
    },
    // 是否超时
    isCheckTimeout(){
        // 当前时间
        var currentTime = Date.now();
        // 缓存的时间
        var timeStamp = this.getTimeStamp()

        return currentTime - timeStamp > constant.TOKEN_TIMEOUT_VALUE
    }
}

